<?php if (!defined('BASEPATH'))exit('No direct script access allowed');
/**
 * 微信活动：毁灭地区控制器
 */
class Destroyearth extends MY_Controller {

    function __construct() {
        parent::__construct();
    }
    //首页
    function index() {
        $this->display('destroyearth/index.html');
    }
    
    //测试结果页面
    function res(){
        $id = trim($_REQUEST['id']);
        $result = $this->db->query("select fraction,percentage from tan_activity_destroyearth  where id = $id  order by id desc limit 1")->row_array();
        if(!$result){
            $this->display('deleted/index.html');exit;
        }
        $result['share_link'] = "http://wx.tan66.com/destroyearth/share.html?id=".$id;
        $result['share_title'] = "我毁灭地球的能力值为".$result['fraction']."分，打败了全国".$result['percentage']."的人，快来测试吧！";
        $this->assign('result',$result);
        $this->display('destroyearth/res.html');
    }
    
    //测试结果页面
    function share(){
        $id = trim($_REQUEST['id']);
        $result = $this->db->query("select fraction,percentage from tan_activity_destroyearth  where id = $id  order by id desc limit 1")->row_array();
        if(!$result){
            $this->display('deleted/index.html');exit;
        }
        $result['share_link'] = "http://wx.tan66.com/destroyearth/share.html?id=".$id;
        $result['share_title'] = "Ta毁灭地球的能力值为".$result['fraction']."分，打败了全国".$result['percentage']."的人，快来测试吧！";
        $this->assign('result',$result);
        $this->display('destroyearth/share.html');
    }
    
}
